<template>
    <!-- 消防管网 -->
    <div class="fire-official-website-wrap">
        <div class="card-title">
            <span class="card-title-text" @click="jumpDeviceDetail">消防管网</span>
        </div>
        <div class="fire-official-website-content">
            <!-- 图 -->
            <div class="fire-official-website-paint"></div>
            <!-- 内容 -->
            <div class="fire-official-website-data">
                <div class="fire-official-website-name">喷淋管网</div>
                <div class="fire-official-website-list">
                    <div class="fire-official-website-item">
                        <p class="item-title">报警</p>
                        <div class="item-value police-state">{{ fireAlarmCount }}</div>
                    </div>
                    <div class="fire-official-website-item">
                        <p class="item-title">故障</p>
                        <div class="item-value malfunction-state">{{ faultAlarmCount }}</div>
                    </div>
                    <div class="fire-official-website-item">
                        <p class="item-title">正常</p>
                        <div class="item-value normal-state">{{ normalCount }}</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import { getFcfRealTimeStatusMultiCount } from '@/api/sysMonitor'

export default {
    name: 'CardFireOfficialWebsite',
    props: {
        orgId: {
            default() {
                return false
            }
        }
    },
    data() {
        return {
            fireAlarmCount: 0,
            faultAlarmCount: 0,
            normalCount: 0
        }
    },
    created() {
        this.getFireHydrantsData()
    },
    methods: {
        getFireHydrantsData() {
            let parames = {
                orgIds: this.orgId || this.$store.state.userInfo.organizationIds,
                fcfsType: 7
            }
            getFcfRealTimeStatusMultiCount(parames).then(res => {
                if(res.status === 200) {
                    this.fireAlarmCount = res.data.fireAlarmCount
                    this.faultAlarmCount = res.data.faultAlarmCount
                    this.normalCount = res.data.normalCount
                }
            })
        },
        jumpDeviceDetail() {
            let that = this
            that.$Ctl.enterDetail('EquipmentList', {
                orgId: that.orgId || that.$store.state.userInfo.organizationIds, // 联网单位Id
                systemId: 12
            })
        }
    }
}
</script>
<style lang="scss" scoped>
.fire-official-website-wrap {
    width: 100%;
    height: 100%;
    .fire-official-website-content {
        display: flex;
        justify-content: space-between;
        padding-top: 20px;
        height: calc(100% - 32px);
        .fire-official-website-paint {
            width: 45%;
            height: 100%;
            background: url(../../assets/images/cards/sprinkler.gif) center center no-repeat;
            background-size: contain;
        }
        .fire-official-website-data {
            display: flex;
            flex-direction: column;
            justify-content: center;
            width: 55%;
            height: 100%;
            .fire-official-website-name {
                padding-left: 20px;
                width: 100%;
                height: 40px;
                line-height: 40px;
                font-size: 28px;
                font-weight: bold;
                color: #1C89EB;
            }
            .fire-official-website-list {
                display: flex;
                align-items: center;
                flex-wrap: wrap;
                justify-content: space-between;
                margin-top: 20px;
                padding-left: 20px;
                width: 100%;
                height: 60px;
                .fire-official-website-item {
                    display: flex;
                    flex-direction: column;
                    height: 70px;
                    line-height: 30px;
                    .item-title {
                        color: #A3BEDD;
                        font-size: 18px;
                    }
                    .item-value {
                        width: 60px;
                        font-size: 20px;
                    }
                    .police-state {
                        color: #B0374F;
                    }
                    .malfunction-state {
                        color: #D29247;
                    }
                    .normal-state {
                        color: #0BB1A8;
                    }
                }
            }
        }
    }
}
</style>
